<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <base href="__STATIC__/">
    <link href="css/Sellerber.css" type="text/css"  rel="stylesheet" />
    <link href="css/bkg_ui.css" type="text/css"  rel="stylesheet" />
    <script src="js/jquery-1.9.1.min.js" type="text/javascript" ></script>
    <script src="js/layer/layer.js" type="text/javascript"></script>
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js" type="text/javascript"></script>
    <script src="js/respond.min.js"></script>
    <script src="js/css3-mediaqueries.js"  type="text/javascript"></script>
    <![endif]-->
    <title>商品图片列表</title>
</head>
<body>
<div class="margin" id="page_style">
    <!--列表展示-->
    <div class="h_products_list clearfix" id="Sellerber">
        <div class="Sellerber_left menu" id="menuBar">
            <div class="show_btn" id="rightArrow"><span></span></div>
            <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>

        </div>
        <div class="list_Exhibition list_show padding15">
            <div class="operation clearfix mb15  searchs_style">
                <a href="{:url('yang/add_goods_img')}"  title="添加属性" class="btn button_btn bg-deep-blue"><i class="fa fa-plus"></i>添加图片</a>
                <button class="btn button_btn btn-danger" type="button" ><i class="fa fa-trash-o"></i>&nbsp;删除</button>
                <div class="search  clearfix">
                    <label class="label_name">搜索：</label><input name="" type="text"  class="form-control col-xs-5"/><button class="btn button_btn bg-deep-blue " onclick=""  type="button"><i class="fa  fa-search"></i>&nbsp;搜索</button>
                </div>
            </div>
            <div class=" datalist_show">
                <div class="datatable_height confirm">
                    <table class="table table_list table_striped table-bordered" id="">
                        <thead>
                        <tr>
                            <th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
                            <th width="100">商品名称</th>
                            <th width="400px">图片</th>
                            <th width="50px">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach ($data as $val) {?>
                        <tr>
                            <td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
                            <td><?= $val['g_name']?></td>
                            <td>
                           <?php foreach($val['g_image'] as $v) {?>
                                <img src="<?php echo $v ?>" alt="" width="100px" height="100px">
                            <?php } ?>
                            </td>
                            <td class="td-manage">
                                <a title="删除" href="javascript:;"  onclick="member_del(this,'{$val.g_id}')" class="btn btn-xs btn-delete" >删除</a>
                            </td>
                        </tr>
                        <?php }?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script>
    $(function () { $(".displayPart").displayPart();  });
    /*删除*/
    function member_del(obj,g_id){
      layer.confirm('确认要删除吗？',function(index){
           $.ajax({
            type: 'GET',
            url: '{:url("yang/goods_img_list_del")}',
            data:{g_id:g_id},
            dataType:'json',
            success: function (data) {
              if(data == 1){

                $(obj).parents("tr").remove();
                layer.msg('已删除 !',{icon:1,time:1000});
              } else if (data == 0){
                console.log(data.msg);
                layer.msg('删除失败 !',{icon:2,time:1000});
              } 
          } 
      })
    })                    
}
</script>
